package dev.ece.suit.utils;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class CellIndex implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5660664058068638537L;

	private int row;
	
	private int col;
	
	public CellIndex(int row, int col) {
		this.row = row;
		this.col = col;
	}
	
	public int getRow() {
		return row;
	}

	public int getCol() {
		return col;
	}
	
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
				.append(this.row)
				.append(this.col).toHashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if(obj == null) {
			return false;
		}
		if(!(obj instanceof CellIndex)) {
			return false;
		}
		CellIndex index = (CellIndex) obj;
		return new EqualsBuilder()
				.append(this.row, index.row)
				.append(this.col, index.col).isEquals();
	}

	@Override
	public String toString() {
		return new StringBuilder()
				.append("[").append(this.row).append(",")
				.append(this.col).append("]")
				.toString();
	}
	
}
